package cn.spike.rockcc.fallback;

import cn.spike.rockcc.errorenum.GlobalExceptionCode;
import cn.spike.rockcc.feign.CourseFeignClient;
import cn.spike.rockcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author:spike
 * @create:2023-03-20 19:07
 */
@Component
public class CourseFallbackFactory implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JSONResult orderdata(String ids) {
                return JSONResult.error(GlobalExceptionCode.COURSE_EXCEPTION);
            }
        };
    }
}
